module.exports = {
  addArticle: (req, res) => {
    const db = require('../db/index')

    const info = req.body
    if (!info.title || !info.cate_id || !info.content || !info.state) {
      return res.cc(1, '数据不完整,请重新检查后再提交')
    }
    if (info.cate_id < 1) {
      return res.cc(1, '文章id不正确')
    }
    if (!info.content.trim()) {
      return res.cc(1, '文章内容不能为空')
    }
    if (info.state !== '已发布' || info.state !== '草稿')
      return res.cc(1, '状态只能输入“已发布”或者"草稿"')
  }
}